﻿using PowerBooking.RSE.Poco;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Objects;
using System.Linq;
using System.Text;
using PowerBooking.RSE.IRepository;

namespace PowerBooking.RSE.Repository
{
    /// <summary>
    /// 城市仓储
    /// </summary>
    public class CityRepository : Repository, ICityRepository
    {
        public CityRepository(DataContext context) : base(context) { }

        /// <summary>
        /// 插入一个城市
        /// </summary>
        /// <param name="cityPoco"></param>
        /// <returns></returns>
        public void InsertCity(CityPoco cityPoco)
        {
            Context.Cities.Add(cityPoco);
        }

        /// <summary>
        /// 根据蜘蛛ID获取城市集合
        /// </summary>
        /// <param name="spiderID"></param>
        /// <returns></returns>
        public IEnumerable<CityPoco> QueryCitiesBySpiderID(long spiderID)
        {
            return Context.Cities.Where(c => c.SpiderID == spiderID);
        }
    }
}
